<?php namespace Home\Controller;
use Hdphp\Controller\Controller;
class OrderController extends CommonController{
	private $model;
	public function __init(){
		//调用CommonController里面的构造函数
		parent::__init();
		$this->model = new \Admin\Model\Goods;
	}
	//购物车页
	public function index(){
		//购物车数据
		$c = Cart::getGoods();
		if($c){
			//新数组 放商品照片 然后传到View
		$d = array();
		foreach ($c as $k => $v) {
			$d[$k]=$this->model->where("gid=".$v['id'])->pluck('gpic');
		}
		//商品图片
		View::with('d',$d);
		//购物车数据
		View::with('c',$c);
		View::make();
		}
		View::error('请重新登录',U('Index/index'));
	}
	//AJAX添加地址
	public function addaddr(){
		$name=Q('post.name','');
		$sheng=Q('post.sheng','');
		$shi=Q('post.shi','');
		$qu=Q('post.qu','');
		$addr=Q('post.addr','');
		$tel=Q('post.tel','');
		$de=Q('post.de','');
		
		if(IS_POST){
			$data = array(
			'consignee' => $name,
			'address_sheng' => $sheng,
			'address_shi' => $shi,
			'address_qu' => $qu,
			'address' => $addr,
			'mobile' => $tel,
			'default' => $de,
			'user_uid'=>$_SESSION['uid'],
			);
		}
	}
	
}
	